package com.frxuexi.mine.room

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Update
import com.frxuexi.mine.entity.User

@Dao
interface UserDao {

    //注册
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun addUser(user: User):Long

    @Update
    fun updataUser(user: User)

    @Delete
    fun deleteUser(user: User)

    //登录查询用户是否存在
    @Query("select * from user where uname=:name and upass=:pass")
    fun queryUser(name:String,pass:String): User?
}